/*
 * @Date: 2022-09-16 09:20:00
 * @LastEditTime: 2022-09-16 09:23:02
 */
import Layout from "@/layout";
export const staticRoutes = [
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true,
  },

  {
    path: "/404",
    component: () => import("@/views/404"),
    hidden: true,
  },
  {
    path: "/",
    component: Layout,
    redirect: "/dashboard",
    children: [
      {
        path: "dashboard",
        name: "首页",
        component: () => import("@/views/dashboard/index"),
        meta: { title: "首页", icon: "dashboard" },
      },
    ],
  },
];

export const allAsyncRoutes = [
  {
    path: "/product",
    name: "Product", //这个名字代表命名路由，后期是要在权限控制当中去使用的，必须配而且名字必须固定，不能变
    component: () => import("@/layout/index.vue"),
    // redirect:'', //不需要重定向，因为它跳转不了，变为箭头，进行展开和合并二级路由菜单了

    // 如果一级路由里面有多个二级路由，那么一级路由的meta需要配置，并且要带标题和图标
    // 如果一级路由里面只有一个二级路由，那么一级路由后面就会被唯一的二级路由替代，直接
    // 让二级路由称为一级路由的菜单，带图标和标题
    meta: {
      title: "商品管理",
      icon: "ele-Goods",
    },
    children: [
      {
        path: "trademark/list",
        component: () => import("@/views/product/trademark/index.vue"),
        // 如果一级路由有菜单并且有图标和标题，那么二级路由只需要配置标题就可以了
        // 不需要配置图标
        meta: {
          title: "品牌管理",
        },
        name: "Trademark",
      },
      {
        path: "attr/list",
        component: () => import("@/views/product/attr/index.vue"),
        meta: {
          title: "平台属性管理",
        },
        name: "Attr",
      },
      {
        path: "sku/list",
        component: () => import("@/views/product/sku/index.vue"),
        meta: {
          title: "Sku管理",
        },
        name: "Sku",
      },
      {
        path: "spu/list",
        component: () => import("@/views/product/spu/index.vue"),
        meta: {
          title: "Spu管理",
        },
        name: "Spu",
      },
      {
        path: "scoped/list",
        component: () => import("@/views/product/scoped/index.vue"),
        meta: {
          title: "Scoped测试",
        },
        name: "Scoped",
      },
    ],
  },
  {
    path: "/sys",
    component: () => import("@/layout/index.vue"),
    redirect: "/acl",
    name: "Acl",
    meta: {
      title: "权限管理",
      icon: "el-icon-setting",
    },
    children: [
      {
        name: "User",
        path: "/acl/user/list",
        component: () => import("@/views/acl/user/index.vue"),
        meta: {
          title: "用户管理",
        },
      },
      {
        name: "Role",
        path: "/acl/role/list",
        component: () => import("@/views/acl/role/index.vue"),
        meta: {
          title: "角色管理",
        },
      },
      {
        name: "RoleAuth",
        path: "/acl/role/auth",
        component: () => import("@/views/acl/role/roleAuth.vue"),
        meta: {
          title: "角色管理",
          hidden: true,
          activeMenu: "/acl/role/list",
        },
      },
      {
        name: "Permission",
        path: "/acl/permission/list",
        component: () => import("@/views/acl/permission/index.vue"),
        meta: {
          title: "菜单管理",
        },
      },
    ],
  },
];

export const anyRoute = {
  path: "*",
  redirect: "/404",
  hidden: true,
};
